from openpyxl import load_workbook

wb = load_workbook("InputData.xlsx")
print(wb.sheetnames)
ws = wb.worksheets[0]
print(ws.title)
Type=""
Type2=""
Type3=""
TypeL1=[]
for i in range(249):

    if(ws[i+2][4].value=="I"):
        Type="1"
    else:
        if(ws[i+2][4].value=="D"):
            Type="0"
        else:
            Type="2"
    if (ws[i + 2][9].value == "I"):
        Type2 = "1"
    else:
        if (ws[i + 2][9].value == "D"):
            Type2 = "0"
        else:
            Type2 = "2"

    if (ws[i + 2][12].value == "W"):
        Type3 = "3"
    else:

        Type3 = "4"

    TypeL1.append(Type+Type2+Type3)

print(TypeL1)

indexType=0
for i in range(249):
    ws["P%d"%(i+2)]=TypeL1[indexType]
    indexType+=1
print(ws.title)
wb.save("InputData.xlsx")

